package net.mihome.app.bean;

import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import net.mihome.app.AppException;
import net.mihome.app.bean.net.ResponsePojo;

public class NewsType implements Serializable{
	private int id;
	private String type_name;
	private String update_at;
	private String create_at;

	private String avatar;
	private int update_size;
	
	public String getAvatar() {
		return avatar;
	}
	public void setAvatar(String avatar) {
		this.avatar = avatar;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getType_name() {
		return type_name;
	}
	public void setType_name(String type_name) {
		this.type_name = type_name;
	}
	public String getUpdate_at() {
		return update_at;
	}
	public void setUpdate_at(String update_at) {
		this.update_at = update_at;
	}
	public String getCreate_at() {
		return create_at;
	}
	public void setCreate_at(String create_at) {
		this.create_at = create_at;
	}
	public int getUpdate_size() {
		return update_size;
	}
	public void setUpdate_size(int update_size) {
		this.update_size = update_size;
	}
	public static NewsType parser(Map map){
		NewsType newsType=new NewsType();
		if(map!=null){
			Double idDouble=(Double) map.get("id");
			newsType.setId(idDouble.intValue());
			newsType.setCreate_at((String) map.get("create_at"));
			newsType.setType_name((String) map.get("type_name"));
			newsType.setUpdate_at((String) map.get("update_at"));
			Double sDouble=(Double) map.get("update_size");
			newsType.setAvatar((String) map.get("avatar"));
			newsType.setUpdate_size(sDouble.intValue());
		}
		return newsType;
	}
	public static List<NewsType> parseList(ResponsePojo responsePojo ) throws IOException, AppException {
		List<NewsType> newslist = new ArrayList<NewsType>();
		List list=(List) responsePojo.getData();
		if(list!=null&&!list.isEmpty()){
			Iterator iterator=list.iterator();
			while(iterator.hasNext()){
				Map map=(Map) iterator.next();
				NewsType news2=NewsType.parser(map);
				newslist.add(news2);
			}
		}
        return newslist;       
	}
}
